package src;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class MarioController implements KeyListener {
	public boolean isRunning = false;

	@Override
	public void keyTyped(KeyEvent e) {

	}

	@Override
	public void keyPressed(KeyEvent e) {
		System.out.println(e.getKeyCode());
		int xSpeed = 15;
		if (e.getKeyCode() == 39) {
			isRunning = true;
			GameJpanel.MARIO_X += xSpeed;
			GameJpanel.MARIO_LEFT_RIGHT = "marioR";
		}
		if (e.getKeyCode() == 37) {
			GameJpanel.MARIO_X -= xSpeed;
			GameJpanel.MARIO_LEFT_RIGHT = "marioL";
		}

	}

	@Override
	public void keyReleased(KeyEvent e) {
		if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT) {
			isRunning = false;
		}
	}

}
